﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;

namespace Data.Repositories
{
    public class SignoRepository
    {
        ModeloCantinhoContainer ctx = new ModeloCantinhoContainer();

        public Signo GetSigno(DateTime data)
        {
            return ctx.GetSigno(data).FirstOrDefault();;
        }

        public SignoChines GetSignoChines(DateTime data)
        {
            return ctx.DatasSignoChines.Where(x=>x.DataInicial <= data && x.DataFinal >= data).SingleOrDefault().SignoChines;
        }

        public Signo GetSignoByNome(string nome)
        {
            return ctx.Signo.Where(x => x.Nome == nome).FirstOrDefault();
        }

        public SignoChines GetSignoChinesByNome(string nome)
        {
            return ctx.SignoChines.Where(x => x.Animal == nome).FirstOrDefault();
        }

        public IEnumerable<Signo> GetAllSignos()
        {
            return ctx.Signo;
        }

        public RelacaoSigno GetCompatibilidades(int SignoOrg,int SignoDest)
        {
            return ctx.RelacaoSigno.Where(x=>x.SignoId1 == SignoOrg && x.SignoId2 == SignoDest).FirstOrDefault();
            
        }
    }
}
